package com.oocl.hgl.crm.store;

import com.oocl.hgl.crm.entity.Person;
import com.oocl.hgl.crm.util.DoubleLinkedList;

public class PersonInfoStorer {
	public static com.oocl.hgl.crm.util.DoubleLinkedList<Person> pList = new DoubleLinkedList<Person>();
	
	
	public void init(){
		Person p;
		
		p=new Person(23, "zero", 0, 0, null, null);
		pList.insert_tail(p);
		
		p=new Person(3, "tommy", 0, 0, null, null);
		pList.insert_tail(p);
		
		p=new Person(13, "able", 0, 0, null, null);
		pList.insert_tail(p);
		
		p=new Person(44, "lance", 0, 0, null, null);
		pList.insert_tail(p);
		
		p=new Person(2, "weir", 0, 0, null, null);
		pList.insert_tail(p);
		
		p=new Person(1, "mike", 0, 0, null, null);
		pList.insert_tail(p);
		
		p=new Person(4, "tom", 0, 0, null, null);
		pList.insert_tail(p);
		
		p=new Person(25, "kate", 0, 0, null, null);
		pList.insert_tail(p);
		
		p=new Person(26, "jack", 0, 0, null, null);
		pList.insert_tail(p);
		
		p=new Person(6, "gawing", 0, 0, null, null);
		pList.insert_tail(p);
	}
	
	public DoubleLinkedList<Person> getPersons(){
		return pList;
	}

	public static void updateCurrentId() {
		if(pList!=null){
			for(int i=0;i<pList.size();i++){
				Person p = pList.get(i);
				if(p!=null){
					if(p.getId()>com.oocl.hgl.crm.entity.Person.currentId){
						com.oocl.hgl.crm.entity.Person.currentId = p.getId();
					}
				}
			}
			com.oocl.hgl.crm.entity.Person.currentId += 1;
		}
	}
}
